//
//  CHCheckBoxUtils.swift
//  jyzx
//
//  Created by cyptt on 2022/4/27.
//

import UIKit

public class CHCheckBoxUtils: NSObject {

    
   var allBtnArr:[UIButton] = []
  public  func addCheckBox(btnArr:[UIButton]){
      self.allBtnArr = btnArr
       for btn in btnArr{
           
           btn.addTarget(self, action: #selector(btnClick(btn:)), for: UIControl.Event.touchUpInside)
       }
    }
    
    /*
     只选择一个btn
     */
    @objc func btnClick(btn:UIButton){
  
        if btn.isSelected == false{
            for otherBtn in self.allBtnArr {
                otherBtn.isSelected = false
            }
            btn.isSelected = true
        }
        
       
    }
}
